﻿using Sustainalytics.Entities.RiskRatings;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.Benchmarkings.Tests
{

    public class ComparativeGroupFixture
    {
        readonly IList<Guid> _companyIds = new[]
   {
            new Guid("00000000-0000-0000-0000-000000000001"),
            new Guid("00000000-0000-0000-0000-000000000002"),
            new Guid("00000000-0000-0000-0000-000000000003"),
            new Guid("00000000-0000-0000-0000-000000000004"),
            new Guid("00000000-0000-0000-0000-000000000005"),
            new Guid("00000000-0000-0000-0000-000000000006"),
            new Guid("00000000-0000-0000-0000-000000000007"),
            new Guid("00000000-0000-0000-0000-000000000008"),
            new Guid("00000000-0000-0000-0000-000000000009"),
            new Guid("00000000-0000-0000-0000-000000000010"),
            new Guid("00000000-0000-0000-0000-000000000011"),
            new Guid("00000000-0000-0000-0000-000000000012"),
            new Guid("00000000-0000-0000-0000-000000000013"),
            new Guid("00000000-0000-0000-0000-000000000014"),
        };

        readonly IList<int> _subSubPeerGroupIdIds = new[]
        {
            1,2,3,4
        };


        public ICollection<RiskRatingResearchProfile> GetCorporateData()
        {
            var companies = new List<RiskRatingResearchProfile>
            {
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[0],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=25.5d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    MarketCapitalization = 30d,
                    CompanyName = "Diversified Financials"
                },

                  new RiskRatingResearchProfile
                {
                    Id = _companyIds[11],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=25.6d } } ,
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    MarketCapitalization = 30d,
                    CompanyName = "Diversified Financials"
                },

                   new RiskRatingResearchProfile
                {
                    Id = _companyIds[12],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=35.5d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    MarketCapitalization = 30d,
                    CompanyName = "Diversified Financials"
                },

                  new RiskRatingResearchProfile
                {
                    Id = _companyIds[13],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=25.8d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    MarketCapitalization = 30d,
                    CompanyName = "Diversified Financials"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[1],
                     ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=30d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[1],
                    MarketCapitalization = 50d,
                    CompanyName = "Diversified Financials"
                }
                ,
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[2],
                     ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=9d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    MarketCapitalization = 100d,
                    CompanyName = "Diversified Financials"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[3],
                    ManagementRisk = new ManagementRisk { UnmanagedRisk = new Timestamped<double> { Value = 70d }
                },
                    SubPeerGroupId = _subSubPeerGroupIdIds[2],
                    MarketCapitalization = 90d,
                    CompanyName = "Electrical Equipment"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[4],
                     ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=29d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[3],
                    MarketCapitalization = 1100d,
                    CompanyName = "Electrical Equipment"
                },

                new RiskRatingResearchProfile
                {
                    Id = _companyIds[5],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=80d } },
                    SubPeerGroupId = _subSubPeerGroupIdIds[1],
                    MarketCapitalization = 80d,
                    CompanyName = "Aerospace & Defense"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[6],
                    ManagementRisk = new ManagementRisk { UnmanagedRisk = new Timestamped<double> { Value = 30d }
                },
                     MarketCapitalization = 130d,
                    SubPeerGroupId = _subSubPeerGroupIdIds[1],
                    CompanyName = "Banks"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[7],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=30d } },
                    MarketCapitalization = 230d,
                    SubPeerGroupId = _subSubPeerGroupIdIds[2],
                    CompanyName = "Banks"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[8],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=35d } },
                    MarketCapitalization = 1130d,
                    SubPeerGroupId = _subSubPeerGroupIdIds[0],
                    CompanyName = "Banks"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[9],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=65d } },
                    MarketCapitalization = 1530d,
                    SubPeerGroupId = _subSubPeerGroupIdIds[3],
                    CompanyName = "Auto Components"
                },
                new RiskRatingResearchProfile
                {
                    Id = _companyIds[10],
                    ManagementRisk = new ManagementRisk{ UnmanagedRisk = new Timestamped<double>{Value=10d } },
                    MarketCapitalization = 300d,
                    SubPeerGroupId = _subSubPeerGroupIdIds[1],
                    CompanyName = "Auto Components"
                }
            };
            return companies;
        }


        public Guid GetCompanyIdByIndex(int index) => _companyIds[index];


        public int GetSubPeerGroupIdByIndex(int index) => _subSubPeerGroupIdIds[index];


        public int[] GetSubPeerGroups() => _subSubPeerGroupIdIds.ToArray();

        public RiskRatingResearchProfile GetCompanyByIndex(int index) => GetCorporateData().ToArray()[index];

        public int Count => _companyIds.Count;
    }



}